package com.lzb.musicplayer.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.basic.ProviderMultiAdapter;
import com.lzb.basic.media.AudioBean;
import com.lzb.musicplayer.R;

import java.text.SimpleDateFormat;

public class SelAudioAdapter extends ProviderMultiAdapter<AudioBean> {

    public SelAudioAdapter() {
        addItemProvider(new SelAudioProvider());
    }

    private class SelAudioProvider extends BaseItemProvider<AudioBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_audio;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, AudioBean bean) {
            baseViewHolder.setText(R.id.tvSelAudioItemName, bean.getName());
            baseViewHolder.setText(R.id.tvSelAudioItemSize, ConvertUtils.byte2FitMemorySize(bean.getSize(), 1));
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundResource(R.id.llSelAudioItem, R.drawable.audio_sel);
            } else {
                baseViewHolder.setBackgroundResource(R.id.llSelAudioItem, R.drawable.black_9_dp);
            }
        }
    }


}
